package com.home.school.controller;

import com.home.school.bean.TUserExt;
import com.home.school.service.TUserExtService;
import com.home.school.vo.UserListVO;
import com.home.school.model.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/api/user/ext")
@RestController
public class UserExtController {

    @Autowired
    private TUserExtService tUserExtService;

    @RequestMapping("/save")
    public R save(@RequestBody TUserExt userVO){
        tUserExtService.save(userVO);
        return R.ok();
    }

    @RequestMapping("/update")
    public R register(@RequestBody TUserExt tUserExt){
        tUserExtService.updateById(tUserExt);
        return R.ok();
    }

    @RequestMapping("byId/{id}")
    public R byId(@PathVariable("id") String id){
        return R.ok().data(tUserExtService.getById(id));
    }

    @RequestMapping("deleted/{id}")
    public R deleted(@PathVariable("id") Integer id){
        return R.ok().data(tUserExtService.removeById(id));
    }

    @RequestMapping("getList")
    public R getListUrl(@RequestBody UserListVO userListVO){
        return tUserExtService.pageList(userListVO);
    }
}
